package com.yaorange.nongjt.certificate.controller.wxapi;

import com.yaorange.nongjt.certificate.bo.CertificatePrintBo;
import com.yaorange.nongjt.certificate.service.INjtCertificateCountService;
import com.yaorange.nongjt.certificate.service.INjtCertificateService;
import com.yaorange.nongjt.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author coach tam
 * @email 327395128@qq.com
 * @values 坚持灵活 灵活坚持
 * @since 2024/10/18
 */
@RestController
@RequestMapping("/api/certificate")
public class NjtCeritificateAPI {

    @Autowired
    private INjtCertificateService njtCertificateService;

    @PostMapping("/batchCode")
    public AjaxResult batchCode(@RequestBody CertificatePrintBo certificatePrintBo) {
        List<String> codeList = njtCertificateService.batchCode(certificatePrintBo);
        return AjaxResult.success(codeList);
    }

    /**
     * 批量保存打印成功记录
     *
     * @param codeList
     * @return
     */
    @PostMapping("/batchSaveByCode")
    public AjaxResult batchSaveByCode(@RequestBody List<String> codeList) {
        return njtCertificateService.batchSaveByCode(codeList);
    }
}
